package com.lemons.hackaton.algorithm;

public class Person extends com.lemons.hackaton.obj.Person{
	
	private Integer currentAwakeTime;
	private Integer currentSleepTime;
	private Float currentBudget;
	private String currentActivity;
	private Boolean sleeping;
	
	public Boolean isSleeping() {
		return sleeping;
	}

	public void setSleeping(Boolean sleeping) {
		this.sleeping = sleeping;
	}

	public Boolean hasCurrentActivity(){
		return !(currentActivity == null);
	}
	
	public Boolean needsToSleep(){
		return (currentAwakeTime == getMaxAwakeTime());
	}
	
	public Boolean needsToWakeUp(){
		return (currentSleepTime == getContinuousSleepTime());
	}
	
	public void goToSleep(){
		//System.out.println("Person " + getName() + " going to sleep");
		sleeping = true;
		currentAwakeTime = 0;
		currentActivity = null;
	}
	
	public void wakeUp(){
//		if (sleeping != null)
//			System.out.println("Person " + getName() + " waking up");
		sleeping = false;
		currentSleepTime = 0;
	}
	
	public String getCurrentActivity() {
		return currentActivity;
	}

	public void setCurrentActivity(String currentActivity) {
		this.currentActivity = currentActivity;
	}

	public Integer getCurrentAwakeTime() {
		return currentAwakeTime;
	}
	
	public void setCurrentAwakeTime(Integer currentAwakeTime) {
		this.currentAwakeTime = currentAwakeTime;
	}
	
	public Integer getCurrentSleepTime() {
		return currentSleepTime;
	}
	
	public void setCurrentSleepTime(Integer currentSleepTime) {
		this.currentSleepTime = currentSleepTime;
	}

	public Float getCurrentBudget() {
		return currentBudget;
	}

	public void setCurrentBudget(Float currentBudget) {
		this.currentBudget = currentBudget;
	}
	
	public void setFields(com.lemons.hackaton.obj.Person person){
		this.setBudget(person.getBudget());
		this.setContinuousSleepTime(person.getContinuousSleepTime());
		this.setMaxAwakeTime(person.getMaxAwakeTime());
		this.setName(person.getName());
		this.setPreferences(person.getPreferences());
	}
	
	@Override
	public String toString() {
		return "Person [name=" + getName() + ", currentBudget=" + currentBudget
				+ ", currentAwakeTime=" + currentAwakeTime + ", maxAwakeTime=" + getMaxAwakeTime() + ", currentSleepTime="
				+ currentSleepTime + ", currentActivity=" + currentActivity + ", preferences= " + getPreferences() + "]\n";
	}
}
